/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "atributo")
@NamedQueries({
    @NamedQuery(name = "Atributo.findAll", query = "SELECT a FROM Atributo a"),
    @NamedQuery(name = "Atributo.findByIdAtributo", query = "SELECT a FROM Atributo a WHERE a.idAtributo = :idAtributo"),
    @NamedQuery(name = "Atributo.findByAtributo", query = "SELECT a FROM Atributo a WHERE a.atributo = :atributo")})
public class Atributo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_atributo")
    private Integer idAtributo;
    @Basic(optional = false)
    @Column(name = "atributo")
    private String atributo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "atributo")
    private List<ValorAtributoPlan> valorAtributoPlanList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "atributo")
    private List<ValorAtributoArticulo> valorAtributoArticuloList;
    @JoinColumn(name = "fid_tipo_atributo", referencedColumnName = "id_tipo_atributo")
    @ManyToOne(optional = false)
    private TipoAtributo tipoAtributo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "atributo")
    private List<AtributoTipoArticulo> atributoTipoArticuloList;

    public Atributo() {
    }

    public Atributo(Integer idAtributo) {
        this.idAtributo = idAtributo;
    }

    public Atributo(Integer idAtributo, String atributo) {
        this.idAtributo = idAtributo;
        this.atributo = atributo;
    }

    public Integer getIdAtributo() {
        return idAtributo;
    }

    public void setIdAtributo(Integer idAtributo) {
        this.idAtributo = idAtributo;
    }

    public String getAtributo() {
        return atributo;
    }

    public void setAtributo(String atributo) {
        this.atributo = atributo;
    }

    public List<ValorAtributoPlan> getValorAtributoPlanList() {
        return valorAtributoPlanList;
    }

    public void setValorAtributoPlanList(List<ValorAtributoPlan> valorAtributoPlanList) {
        this.valorAtributoPlanList = valorAtributoPlanList;
    }

    public List<ValorAtributoArticulo> getValorAtributoArticuloList() {
        return valorAtributoArticuloList;
    }

    public void setValorAtributoArticuloList(List<ValorAtributoArticulo> valorAtributoArticuloList) {
        this.valorAtributoArticuloList = valorAtributoArticuloList;
    }

    public TipoAtributo getTipoAtributo() {
        return tipoAtributo;
    }

    public void setTipoAtributo(TipoAtributo tipoAtributo) {
        this.tipoAtributo = tipoAtributo;
    }

    public List<AtributoTipoArticulo> getAtributoTipoArticuloList() {
        return atributoTipoArticuloList;
    }

    public void setAtributoTipoArticuloList(List<AtributoTipoArticulo> atributoTipoArticuloList) {
        this.atributoTipoArticuloList = atributoTipoArticuloList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAtributo != null ? idAtributo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Atributo)) {
            return false;
        }
        Atributo other = (Atributo) object;
        if ((this.idAtributo == null && other.idAtributo != null) || (this.idAtributo != null && !this.idAtributo.equals(other.idAtributo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.Atributo[idAtributo=" + idAtributo + "]";
    }

}
